package RemotePlay.test;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
//import java.rmi.naming;
import java.rmi.RemoteException;
//import java.rmi.MalformedURLException;
  
public class RmiServer{
    IntHelloRmi helloRmi;
    public void server() throws RemoteException,MalformedURLException,AlreadyBoundException{
        helloRmi = new ImpHelloRmi();
        //远程对象注册表实例
        LocateRegistry.createRegistry(9999);
        //把远程对象注册到RMI注册服务器上
        try {
            Naming.bind("rmi://localhost:9999/HelloRmi",helloRmi);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        System.out.println("server：对象绑定成功");
    }
}